﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ShortcutMenu.Render
{
    /// <summary>
    /// 桌面渲染
    /// </summary>
    public class DesktopRender : RenderBase
    {
        public DesktopRender(MainWindow mainWindow) : base(mainWindow)
        { }

        public override void Show()
        {
            _mainWindow.WindowState = WindowState.Maximized;

            _mainWindow.Show();
            SY_Library.Animate.Double(_mainWindow, MainWindow.OpacityProperty, _mainWindow.Opacity, 1, 200);
        }

        public override void Hide()
        {
            //主窗口隐藏
            SY_Library.Animate.Double(_mainWindow, MainWindow.OpacityProperty, _mainWindow.Opacity, 0, 200);

            Task.Run(() =>
            {
                Task.Delay(500).Wait();
                _mainWindow.Dispatcher.Invoke(() => { _mainWindow.Hide(); });
            });
        }




    }
}
